package eva.savant.businessobject.ad;

import javax.persistence.*;
import java.util.Collection;
import org.hibernate.annotations.LazyCollection;
import org.hibernate.annotations.LazyCollectionOption;

@Table(name="AD_MENU")
@javax.persistence.Entity(name = "ad.Menu")
public class Menu extends eva.savant.businessobject.Entity {

    @Id
    @Column(name = "ID_MENU", length = 30, nullable = false)
    private String id; //ID Arbol

    @ManyToOne
    @JoinColumn(name = "ID_PADRE", nullable = true)
    private Menu padre; //ID Menu Padre

    @Basic
    @Column(name = "ID_SISTEMA", length = 4, nullable = false)
    private String idSistema; //ID Sistema

    @ManyToOne
    @JoinColumn(name = "ID_TRANSACCION", nullable = true)
    private Transaccion transaccion; //ID Transaccion

    @Basic
    @Column(name = "NOMBRE", length = 30, nullable = false)
    private String nombre; //Nombre

    @OneToMany
    (mappedBy = "padre") @LazyCollection(LazyCollectionOption.FALSE)
    private Collection<Menu> lsMenu;

    @OneToMany
    (mappedBy = "menu")
    private Collection<Rol> lsRol;


    public Menu(String id, Menu padre, String idSistema, Transaccion transaccion, String nombre, Integer operacionId, String sociedadId, Integer usuarioId) {

        this.id= id;

        this.padre= padre;

        this.idSistema= idSistema;

        this.transaccion= transaccion;

        this.nombre= nombre;

        this.operacionId= operacionId;

        this.sociedadId= sociedadId;

        this.usuarioId= usuarioId;

    }

    public Menu() {

    }


    public String getId() {
    
        return id;
    }
    
    public void setId(String id) {
    
        this.id = id;
    }

    public Menu getPadre() {
    
        return padre;
    }
    
    public void setPadre(Menu padre) {
    
        this.padre = padre;
    }

    public String getIdSistema() {
    
        return idSistema;
    }
    
    public void setIdSistema(String idSistema) {
    
        this.idSistema = idSistema;
    }

    public Transaccion getTransaccion() {
    
        return transaccion;
    }
    
    public void setTransaccion(Transaccion transaccion) {
    
        this.transaccion = transaccion;
    }

    public String getNombre() {
    
        return nombre;
    }
    
    public void setNombre(String nombre) {
    
        this.nombre = nombre;
    }

    public Collection<Menu> getLsMenu() {
    
        return lsMenu;
    }
    
    public void setLsMenu(Collection<Menu> lsMenu) {
    
        this.lsMenu = lsMenu;
    }

    public Collection<Rol> getLsRol() {
    
        return lsRol;
    }
    
    public void setLsRol(Collection<Rol> lsRol) {
    
        this.lsRol = lsRol;
    }

}
